package epam.com.study.xml.classes;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

import org.apache.log4j.Logger;

import epam.com.study.xml.enums.TypeOfStonesEnum;


@XmlAccessorType(XmlAccessType.FIELD) 
public class Stone {
	
	@XmlElement(name = "tns:id")
	private Integer id; 
	@XmlElement(name = "tns:name")
	private String name;
	@XmlElement(name = "tns:preciousness")
	private TypeOfStonesEnum preciousness;
	@XmlElement(name = "tns:origin")
	private String origin; 
	@XmlElement(name = "tns:value")
	private Integer value; 
	@XmlElement(name = "tns:visual-parameters")
	private VisualParameters visualParameters;
	
	private static final Logger log = Logger.getLogger(Stone.class);

	public void setId(Integer value) {
		id = value;
	}
	public Integer getId() {
		return id;
	}
	
	public void setName(String value) {
		if (value.length()> 0) {
			name = value;
		} else {
			log.warn("Name required!!!");
		}
	}
	public String getName() {
		return name;
	}

	public void setPreciousness(TypeOfStonesEnum value) {
		preciousness = value;
	}
	public TypeOfStonesEnum getPreciousness() {
		return preciousness;
	}
	
	public void setOrigin(String value) {
		origin = value;
	}
	public String getOrigin() {
		return origin;
	}
	
	public void setValue(Integer value) {
		this.value = value;
	}
	public Integer getValue() {
		return value;
	}
	
	public void setVisualParameters( VisualParameters visualParameters ) {
		this.visualParameters = visualParameters;
	};
	public VisualParameters getVisualParameters() {
		return visualParameters;
	};
	
	public void toPrint() {
		  log.info( "class STONE:" );		
		  log.info( "name - "+ getName() );		
		  log.info( "id - "+ getId() );
		  log.info( "origin - "+ getOrigin() );		
		  log.info( "value - "+ getValue() );		
		  log.info( "preciousness - "+ getPreciousness().toString() );		
		  log.info( "visual parameters :" );		
		  log.info( "  color - "+visualParameters.getColor().toString() );		
		  log.info( "  transparency - "+visualParameters.getTransparency() );		
		  log.info( "  edge - "+visualParameters.getEdge() );	
		  log.info("");		
	}
	
	
}
